package controller.category;

import com.alibaba.fastjson.JSONArray;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import pojo.Category;
import service.category.CategoryService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/category")

public class CategoryController {
    @Resource
    private CategoryService categoryService;
    //三级联动
    @ResponseBody
    @RequestMapping(value = "/getFenji",produces = {"application/json;charset=utf-8"})
    public Object getFenji(Integer parentId){
        List<Category> categoryList = categoryService.getCategoryList(parentId);
        return JSONArray.toJSONString(categoryList);
    }
}
